package library;

public class Book {
    //书名
    private String name;
    //作者
    private String author;
    //价格
    private double price;
    //类型
    private String type;
    //是否借出
    private boolean isborrowed;

    public Book(String name, String author, double price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
        isborrowed = false;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean getBorrowed() {
        return isborrowed;
    }

    public void setBorrowed(boolean borrowed) {
        this.isborrowed = borrowed;
    }

    @Override
    public String toString() {
        if (isborrowed == true) {
            return  "书名='" + name + '\'' +
                    ", 作者：'" + author + '\'' +
                    ", 价格：" + price +
                    ", 类型：'" + type + '\'' +
                    ", 是否借出：是";
        }else {
            return  "书名='" + name + '\'' +
                    ", 作者：'" + author + '\'' +
                    ", 价格：" + price +
                    ", 类型：'" + type + '\'' +
                    ", 是否借出：否";
        }
    }
}
